﻿///////////////////////////////////////////////////////////////
// This is generated code. 
//////////////////////////////////////////////////////////////
// Code is generated using LLBLGen Pro version: 3.5
// Code is generated on: Monday, December 17, 2012 11:21:26 AM
// Code is generated using templates: SD.TemplateBindings.SharedTemplates.NET20
// Templates vendor: Solutions Design.
// Templates version: 
//////////////////////////////////////////////////////////////
using System;
using System.Collections;
using System.Collections.Generic;
using WHMS;
using WHMS.FactoryClasses;
using WHMS.HelperClasses;
using SD.LLBLGen.Pro.ORMSupportClasses;

namespace WHMS.RelationClasses
{
	/// <summary>Implements the relations factory for the entity: Contractor. </summary>
	public partial class ContractorRelations
	{
		/// <summary>CTor</summary>
		public ContractorRelations()
		{
		}

		/// <summary>Gets all relations of the ContractorEntity as a list of IEntityRelation objects.</summary>
		/// <returns>a list of IEntityRelation objects</returns>
		public virtual List<IEntityRelation> GetAllRelations()
		{
			List<IEntityRelation> toReturn = new List<IEntityRelation>();
			toReturn.Add(this.ProjectContractorEntityUsingContractorId);
			toReturn.Add(this.WithdrawRequestEntityUsingContractorId);
			toReturn.Add(this.WithdrawTransactionEntityUsingContractorId);
			toReturn.Add(this.WithdrawzPartyEntityUsingWithdrawzPartyId);
			return toReturn;
		}

		#region Class Property Declarations

		/// <summary>Returns a new IEntityRelation object, between ContractorEntity and ProjectContractorEntity over the 1:n relation they have, using the relation between the fields:
		/// Contractor.Id - ProjectContractor.ContractorId
		/// </summary>
		public virtual IEntityRelation ProjectContractorEntityUsingContractorId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany, "ProjectContractors" , true);
				relation.AddEntityFieldPair(ContractorFields.Id, ProjectContractorFields.ContractorId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("ContractorEntity", true);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("ProjectContractorEntity", false);
				return relation;
			}
		}

		/// <summary>Returns a new IEntityRelation object, between ContractorEntity and WithdrawRequestEntity over the 1:n relation they have, using the relation between the fields:
		/// Contractor.Id - WithdrawRequest.ContractorId
		/// </summary>
		public virtual IEntityRelation WithdrawRequestEntityUsingContractorId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany, "WithdrawRequests" , true);
				relation.AddEntityFieldPair(ContractorFields.Id, WithdrawRequestFields.ContractorId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("ContractorEntity", true);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("WithdrawRequestEntity", false);
				return relation;
			}
		}

		/// <summary>Returns a new IEntityRelation object, between ContractorEntity and WithdrawTransactionEntity over the 1:n relation they have, using the relation between the fields:
		/// Contractor.Id - WithdrawTransaction.ContractorId
		/// </summary>
		public virtual IEntityRelation WithdrawTransactionEntityUsingContractorId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany, "WithdrawTransactions" , true);
				relation.AddEntityFieldPair(ContractorFields.Id, WithdrawTransactionFields.ContractorId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("ContractorEntity", true);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("WithdrawTransactionEntity", false);
				return relation;
			}
		}


		/// <summary>Returns a new IEntityRelation object, between ContractorEntity and WithdrawzPartyEntity over the m:1 relation they have, using the relation between the fields:
		/// Contractor.WithdrawzPartyId - WithdrawzParty.Id
		/// </summary>
		public virtual IEntityRelation WithdrawzPartyEntityUsingWithdrawzPartyId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.ManyToOne, "WithdrawzParty", false);
				relation.AddEntityFieldPair(WithdrawzPartyFields.Id, ContractorFields.WithdrawzPartyId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("WithdrawzPartyEntity", false);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("ContractorEntity", true);
				return relation;
			}
		}
		/// <summary>stub, not used in this entity, only for TargetPerEntity entities.</summary>
		public virtual IEntityRelation GetSubTypeRelation(string subTypeEntityName) { return null; }
		/// <summary>stub, not used in this entity, only for TargetPerEntity entities.</summary>
		public virtual IEntityRelation GetSuperTypeRelation() { return null;}
		#endregion

		#region Included Code

		#endregion
	}
	
	/// <summary>Static class which is used for providing relationship instances which are re-used internally for syncing</summary>
	internal static class StaticContractorRelations
	{
		internal static readonly IEntityRelation ProjectContractorEntityUsingContractorIdStatic = new ContractorRelations().ProjectContractorEntityUsingContractorId;
		internal static readonly IEntityRelation WithdrawRequestEntityUsingContractorIdStatic = new ContractorRelations().WithdrawRequestEntityUsingContractorId;
		internal static readonly IEntityRelation WithdrawTransactionEntityUsingContractorIdStatic = new ContractorRelations().WithdrawTransactionEntityUsingContractorId;
		internal static readonly IEntityRelation WithdrawzPartyEntityUsingWithdrawzPartyIdStatic = new ContractorRelations().WithdrawzPartyEntityUsingWithdrawzPartyId;

		/// <summary>CTor</summary>
		static StaticContractorRelations()
		{
		}
	}
}
